<?php
declare (strict_types = 1);

namespace app\admin\validate;

use think\Validate;

class GoodsProp extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'pname'     => 'require|max:20',
        'pvalues'   => 'require',
        'sort_order'=> 'require|between:0,255',
    ];
    protected $field = [
        'pname'      => '属性名',
        'pvalues'    => '属性值',
        'sort_order' => '排序值',
    ];
    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'pname'               =>  '属性名不能超过20个字符!',
        'pvalues'             =>  '请选择属性值！',
        'sort_order'          => '排序值必须在0~255之间!',

    ];

    protected $scene = [
        'edit'  =>  ['pname','pvalues','sort_order'],
    ];
}
